﻿<Fluent:RibbonWindow x:Class="GBlason.MainWindow"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
                     xmlns:ViewModel="clr-namespace:GBlason.ViewModel"
                     xmlns:Properties="clr-namespace:GBlason.Properties"
                     xmlns:Aggregate="clr-namespace:GBlason.Control.Aggregate"
                     xmlns:Tools="clr-namespace:GBlason.Common.Tools"
                     Title="{Binding Path=ApplicationTitle}"
                     Width="{Binding Path=MainWindowWidth}"
                     Height="{Binding Path=MainWindowHeight}"
                     Top="{Binding Path=MainWindowTop}"
                     Left="{Binding Path=MainWindowLeft}"
                     WindowState="{Binding Path=MainWindowState}"
                     mc:Ignorable="d"
                     Background="{StaticResource GlobalBackgroundBrush}"
                     Icon="Pictures\Icons32\shield.png"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:CustomCommand="clr-namespace:GBlason.Common.CustomCommand"
                     xmlns:MenuControl="clr-namespace:GBlason.Control.MenuControl"
                     xmlns:Converter="clr-namespace:GBlason.Common.Converter"
                     xmlns:Culture="clr-namespace:GBlason.Culture"
                     xmlns:Resources="clr-namespace:GBL.Repository.Resources;assembly=Repository"
                     xmlns:General="clr-namespace:GBlason.ViewModel.General" d:DesignWidth="750" d:DesignHeight="600"
                     DataContext="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}}"
                     d:DataContext="{Binding Source={x:Static Tools:DesignTimeViewModel.GlobalAppViewModel}}">
    <Fluent:RibbonWindow.Resources>
        <Converter:SelectionToVisibilityConverter x:Key="SelectionToVisibility"/>
    </Fluent:RibbonWindow.Resources>
    
    <Fluent:RibbonWindow.CommandBindings>
        <CommandBinding x:Name="OpenCommand" Command="Open" CanExecute="OpenCommandCanExecute" Executed="OpenCommandExecuted"/>
        <CommandBinding x:Name="NewCommand" Command="New" CanExecute="NewCommandCanExecute"  Executed="NewCommandExecuted"/>
        <CommandBinding x:Name="SaveCommand" Command="Save" CanExecute="SaveCommandCanExecute" Executed="SaveCommandExecuted"/>
        <CommandBinding x:Name="SaveAsCommand" Command="SaveAs" CanExecute="SaveAsCommandCanExecute" Executed="SaveAsCommandExecuted"/>
        <CommandBinding Command="{x:Static CustomCommand:CommandMenu.RecentObjectSelect}" Executed="RecentObjectSelected"/>
        <CommandBinding x:Name="AddDivisionCommand" Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                        CanExecute="AddDivisionCommandCanExecute" Executed="AddDivisionCommandExecuted"/>
        <CommandBinding x:Name="AddResourceCommand" Command="{x:Static CustomCommand:CommandMenu.AddResource}" CanExecute="AddResourceCommandCanExecute" Executed="AddResourceCommandExecuted"/>
        <CommandBinding x:Name="DeleteResourceCommand" Command="{x:Static ApplicationCommands.Delete}" CanExecute="DeleteResourceCommandCanExecute" Executed="DeleteResourceCommandExecuted"/>
        <CommandBinding x:Name="ViewResourceCommand" Command="{x:Static CustomCommand:CommandMenu.ViewResource}"
                        CanExecute="ViewResourceCommandCanExecute"  Executed="ViewResourceCommandExecuted"/>
        <CommandBinding x:Name="EditResourceCommand" Command="{x:Static CustomCommand:CommandMenu.EditResource}"
                        CanExecute="EditResourceCommandCanExecute"  Executed="EditResourceCommandExecuted"/>
    </Fluent:RibbonWindow.CommandBindings>

    <DockPanel LastChildFill="True">
        <Fluent:Ribbon DockPanel.Dock="Top" x:Name="ApplicationRibbon">
            <!--Backstage-->
            <Fluent:Ribbon.Menu>
                <Fluent:Backstage Header="{x:Static Properties:Resources.MenuTitleLabel}" x:Name="FileMenu">
                    <Fluent:BackstageTabControl SelectedValue="MenuRecentItem">
                        <Fluent:Button Header="{x:Static Properties:Resources.MenuLabelSave}" Icon="Pictures\Icons16\disk.png"
                                       Command="Save"/>
                        <Fluent:Button Header="{x:Static Properties:Resources.MenuLabelSaveAs}" Icon="Pictures\Icons16\save_as.png"
                                       Command="SaveAs"/>
                        <Fluent:Button Header="{x:Static Properties:Resources.MenuLabelOpen}" Icon="Pictures\Icons16\folder_page.png"
                                       Command="Open"/>
                        <Fluent:BackstageTabItem Header="{x:Static Properties:Resources.MenuLabelRecent}" x:Name="MenuRecentItem">
                            <MenuControl:RecentDocumentMenu DataContext="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}}"
                                                          Margin="4,4,30,4"/>
                        </Fluent:BackstageTabItem>
                        <Fluent:BackstageTabItem Header="{x:Static Properties:Resources.MenuLabelNew}">
                            <MenuControl:NewDocumentMenu Margin="4,4,0,0"/>
                        </Fluent:BackstageTabItem>
                        <Fluent:BackstageTabItem Header="{x:Static Properties:Resources.MenuLabelHelp}"/>
                        <Fluent:BackstageTabItem Header="{x:Static Properties:Resources.ButtonLabelOptions}">
                            <MenuControl:PropertiesMenu />
                        </Fluent:BackstageTabItem>
                        <Fluent:Button Header="{x:Static Properties:Resources.ButtonLabelQuit}" Icon="Pictures\Icons16\cross.png"/>
                    </Fluent:BackstageTabControl>
                </Fluent:Backstage>
            </Fluent:Ribbon.Menu>
            <!--contextual tabs-->
            <Fluent:Ribbon.ContextualGroups>
                <Fluent:RibbonContextualTabGroup Header="{x:Static Properties:Resources.MenuContextHeaderDivisible}"
                                                 Visibility="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}, Path=CurrentlyDisplayedFile.CurrentlySelectedComponent.DivisibleVisibility, Mode=OneWay, TargetNullValue=Hidden}"
                                                 x:Name="MenuContextHeaderDivisible" Background="Orange" BorderBrush="Orange" />
            </Fluent:Ribbon.ContextualGroups>
            <!--Tabs-->
            <Fluent:RibbonTabItem Header="{x:Static Properties:Resources.TabLabelHome}" x:Name="TabHome">
                <Fluent:RibbonGroupBox Header="{x:Static Properties:Resources.GroupLabelClipboard}">
                    <Fluent:SplitButton Name="ButtonPaste" Header="{x:Static Properties:Resources.ButtonLabelPaste}"
                                        Icon="Pictures\Icons16\paste_plain.png"
                                        LargeIcon="Pictures\Icons32\paste_plain.png">
                        <Fluent:SplitButton.Items>
                            <Fluent:MenuItem Header="{x:Static Properties:Resources.MenuLabelPaste}" Icon="Pictures\Icons16\paste_plain.png"/>
                            <Fluent:MenuItem Header="{x:Static Properties:Resources.MenuLabelPasteSpecial}" Icon="Pictures\Icons16\paste_plain.png"/>
                        </Fluent:SplitButton.Items>
                    </Fluent:SplitButton>
                    <Fluent:Button Name="ButtonCut" Header="{x:Static Properties:Resources.ButtonLabelCut}" SizeDefinition="Middle,Small" Icon="Pictures\Icons16\cut.png"/>
                    <Fluent:Button Name="ButtonCopy" Header="{x:Static Properties:Resources.ButtonLabelCopy}" SizeDefinition="Middle,Small" Icon="Pictures\Icons16\page_copy.png"/>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Header="{x:Static Properties:Resources.TabLabelResources}" x:Name="TabResources">
                <Fluent:RibbonGroupBox Header="{x:Static Properties:Resources.GroupLabelShapes}">
                    <Fluent:Button Header="{x:Static Properties:Resources.ButtonLabelView}"
                                   Icon="pack://application:,,,/Pictures\Icons16\shape_square_go.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\shape_square_go.png"
                                   Command="{x:Static CustomCommand:CommandMenu.ViewResource}"
                                   />
                    <Fluent:Button Header="{x:Static Properties:Resources.ButtonLabelAdd}"
                                   Icon="pack://application:,,,/Pictures\Icons16\shape_square_add.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\shape_square_add.png"
                                   SizeDefinition="Middle,Small"/>
                    <Fluent:Button Header="{x:Static Properties:Resources.ButtonLabelEdit}"
                                   Icon="pack://application:,,,/Pictures\Icons16\shape_square_edit.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\shape_square_edit.png"
                                   SizeDefinition="Middle,Small"/>
                    <Fluent:Button Header="{x:Static Properties:Resources.ButtonLabelDelete}"
                                   Icon="pack://application:,,,/Pictures\Icons16\shape_square_delete.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\shape_square_delete.png"
                                   SizeDefinition="Middle,Small"/>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Header="{x:Static Properties:Resources.TabLabelCut}" x:Name="TabDivision"
                                  Group="{Binding ElementName=MenuContextHeaderDivisible}">
                <Fluent:RibbonGroupBox Header="{x:Static Properties:Resources.GroupLabelBasicDivision}" x:Name="GroupDivision">
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartyPlain}" x:Name="ButtonNoDivision"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartyPlain}"
                                   Icon="Pictures\Icons16\division_plain.png" LargeIcon="Pictures\Icons32\division_plain.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartyFess}" x:Name="ButtonFess"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartyFess}"
                                   Icon="pack://application:,,,/Pictures\Icons16\division_partyperfess.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\division_partyperfess.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartyPale}" x:Name="ButtonPale"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartyPale}"
                                   Icon="pack://application:,,,/Pictures\Icons16\division_partyperpale.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\division_partyperpale.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartyBend}" x:Name="ButtonBend"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartyBend}"
                                   Icon="pack://application:,,,/Pictures\Icons16\division_partyperbend.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\division_partyperbend.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartyBendSinister}" x:Name="ButtonBendSinister"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartyBendSinister}"
                                   Icon="pack://application:,,,/Pictures\Icons16\division_partyperbendsinister.png"
                                   LargeIcon="pack://application:,,,/Pictures\Icons32\division_partyperbendsinister.png"/>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="{x:Static Properties:Resources.GroupLabelAdvancedDivision}" x:Name="GroupAdvancedDivision">
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartySaltire}" x:Name="ButtonSaltire"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartySaltire}"
                                   Icon="Pictures\Icons16\construction.png" LargeIcon="Pictures\Icons32\construction.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartyCross}" x:Name="ButtonPartyCross"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartyCross}"
                                   Icon="Pictures\Icons16\construction.png" LargeIcon="Pictures\Icons32\construction.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.PartyPall}" x:Name="ButtonPall"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.PartyPall}"
                                   Icon="Pictures\Icons16\construction.png" LargeIcon="Pictures\Icons32\construction.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.TiercedBend}" x:Name="ButtonTiercedBend"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.TiercedBend}"
                                   Icon="Pictures\Icons16\construction.png" LargeIcon="Pictures\Icons32\construction.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.TiercedBendSinister}" x:Name="ButtonTiercedBendSinister"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.TiercedBendSinister}"
                                   Icon="Pictures\Icons16\construction.png" LargeIcon="Pictures\Icons32\construction.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.TiercedPale}" x:Name="ButtonTiercedPale"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.TiercedPale}"
                                   Icon="Pictures\Icons16\construction.png" LargeIcon="Pictures\Icons32\construction.png"/>
                    <Fluent:Button Header="{x:Static Culture:BlasonVocabulary.TiercedFess}" x:Name="ButtonTiercedFess"
                                   Command="{x:Static CustomCommand:CommandMenu.AddingDivision}"
                                   CommandParameter="{x:Static Resources:DivisionType.TiercedFess}"
                                   Icon="Pictures\Icons16\construction.png" LargeIcon="Pictures\Icons32\construction.png"/>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Header="{x:Static Properties:Resources.TabLabelOrdinaries}" x:Name="TabOrdinaries"
                                  Group="{Binding ElementName=MenuContextHeaderDivisible}">
                <Fluent:RibbonGroupBox Header="{x:Static Properties:Resources.GroupLabelHonourableOrdinaries}" x:Name="GroupHonourableOrdinaries">

                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="{x:Static Properties:Resources.GroupLabelSubOrdinaries}" x:Name="GroupSubOrdinaries">

                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <!--<Fluent:RibbonTabItem Header="{x:Static Properties:Resources.TabLabelTinctures}" x:Name="TabTinctures"
                                  Group="{Binding ElementName=MenuContextFillable}">
                <Fluent:RibbonGroupBox x:Name="GroupLabelBasicTinctures" Header="{x:Static Properties:Resources.GroupLabelBasicTinctures}">
                    <Fluent:Button x:Name="ButtonOr" Header="{x:Static Culture:BlasonVocabulary.TinctureOr}" />
                    <Fluent:Button x:Name="ButtonArgent" Header="{x:Static Culture:BlasonVocabulary.TinctureArgent}"/>
                    <Fluent:SeparatorTabItem />
                    <Fluent:Button x:Name="ButtonAzure" Header="{x:Static Culture:BlasonVocabulary.TinctureAzure}"/>
                    <Fluent:Button x:Name="ButtonVert" Header="{x:Static Culture:BlasonVocabulary.TinctureVert}"/>
                    <Fluent:Button x:Name="ButtonGules" Header="{x:Static Culture:BlasonVocabulary.TinctureGules}"/>
                    <Fluent:Button x:Name="ButtonSable" Header="{x:Static Culture:BlasonVocabulary.TinctureSable}"/>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox x:Name="GroupLabelModernTinctures" Header="{x:Static Properties:Resources.GroupLabelModernTinctures}">

                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox x:Name="GroupLabelFurs" Header="{x:Static Properties:Resources.GroupLabelFurs}">

                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox x:Name="GroupLabelCustomTinctures" Header="{x:Static Properties:Resources.GroupLabelCustomTinctures}">

                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>-->
        </Fluent:Ribbon>
        <Aggregate:ApplicationStatusBar DockPanel.Dock="Bottom" x:Name="StatusBar" Margin="0,2,0,0"/>
        <Aggregate:CustomGUI x:Name="MainFrame"/>
    </DockPanel>

</Fluent:RibbonWindow>